package interPhoneAction;

import com.opensymphony.xwork2.ActionSupport;

import interPhone.InterPhone;
import interPhoneDao.InterPhoneDao;

public class InterPhoneAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Long id;

	private InterPhone interPhone;

	private InterPhoneDao interPhoneDao;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public InterPhone getInterPhone() {
		return interPhone;
	}

	public void setInterPhone(InterPhone interPhone) {
		this.interPhone = interPhone;
	}

	public InterPhoneDao getInterPhoneDao() {
		return interPhoneDao;
	}

	public void setInterPhoneDao(InterPhoneDao interPhoneDao) {
		this.interPhoneDao = interPhoneDao;
	}

	public String create() {
		return SUCCESS;
	}

	public String delete() {
		return SUCCESS;
	}

	public String updateSurvey() {
		InterPhone temp = interPhoneDao.selectAll();
		interPhone.setId(temp.getId());
		interPhone.setProjector(temp.getProjector());
		interPhone.setFeature(temp.getFeature());
		interPhoneDao.update(interPhone);
		return SUCCESS;
	}

	public String updateProjector() {
		InterPhone temp = interPhoneDao.selectAll();
		interPhone.setId(temp.getId());
		interPhone.setFeature(temp.getFeature());
		interPhone.setSurvey(temp.getSurvey());
		interPhoneDao.update(interPhone);
		return SUCCESS;
	}

	public String updateFeature() {
		InterPhone temp = interPhoneDao.selectAll();
		interPhone.setId(temp.getId());
		interPhone.setProjector(temp.getProjector());
		interPhone.setSurvey(temp.getFeature());
		interPhoneDao.update(interPhone);
		return SUCCESS;
	}

	public String select() {
		interPhone = interPhoneDao.selectAll();
		return SUCCESS;
	}

}
